<%-- 
    Document   : detailproduct
    Created on : Jan 13, 2013, 3:31:11 PM
    Author     : KAKAIT
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="model.entity.Product"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<div class="col-main" id="ves-col-main">
						<!-- main content -->
    <script type="text/javascript">
            var optionsPrice = new Product.OptionsPrice([]);
            window.document.title ="Detail Product";
        </script>
        <%
    Product pro = (Product)session.getAttribute("detailpro");   
%>
        
    <div id="messages_product_view"></div>
    <div class="product-name page-title">
                    <h1><%= pro.getProductname() %></h1>
    </div>
    <div class="product-view">
        <div class="product-essential">
            <form id="product_addtocart_form" method="POST" action="<c:url value="/Detailaddcart">
                                           <c:param name="id" value="<%= String.valueOf(pro.getProductid())%>"></c:param></c:url>">
            <div class="no-display">
                <input type="hidden" value="7" name="product">
                <input type="hidden" value="" id="related-products-field" name="related_product">
            </div>

            <div class="product-shop">
                <div class="short-description">
                    <h2>Quick Overview</h2>	                    
                    <div class="std"><%= pro.getProductdetail() %></div>
                </div>

                <div id="ves-product-shop">	
                    <ul class="add-to-links">
                                    <li><span class="separator">|</span> <a class="link-compare" href="<c:url value="/listcompare"><c:param name="id" value="<%= String.valueOf(pro.getProductid())%>"></c:param></c:url>">Add to Compare</a></li>
                    </ul>
                        <p class="availability in-stock">Availability: <span>In stock</span></p>
                    <div class="price-box">
                                        <p class="old-price">
                                            <span class="price-label">Regular Price:</span>
                                            <span id="old-price-6" class="price">
                                                $<%= pro.getUnitcost() %>               </span>
                                        </p>
                                        <p class="special-price">
                                            <span class="price-label">Special Price:</span>
                                            <span id="product-price-6" class="price">
                                                $<%= pro.getTotalamount() %>               </span>
                                        </p>
                    </div>
                </div>
                <div class="add-to-box">
                    <div class="add-to-cart">
                        <label for="qty">Qty:</label>
                        <input type="text" class="input-text qty" title="Qty" value="1" maxlength="12" id="qty" name="qty">
                        <button onclick="productAddToCartForm.submit(this)" class="button btn-cart" title="Add to Cart" type="button"><span><span>Add to Cart</span></span></button>
                    </div>
                </div>
            </div>

            <div class="product-img-box">
                        <!-- jQuery LightBoxes -->
                                    <!-- FancyBox -->
            
            <!-- //FancyBox -->
                    <!-- //jQuery LightBoxes -->

                        <p class="product-image">
                                <a title="" class="" rel="fancybox" href="images/product/<%= pro.getPicture() %>"><img title="" alt="" src="images/product/<%= pro.getPicture() %>"></a>
                        </p>    


            </div>

                <div class="clearer"></div>
        </form>
            <script type="text/javascript">
        //&lt;![CDATA[
                var productAddToCartForm = new VarienForm('product_addtocart_form');
                productAddToCartForm.submit = function(){
                        if (this.validator.validate()) {
                                this.form.submit();
                        }
                }.bind(productAddToCartForm);
        //]]&gt;
        </script>
        </div>
        <div class="product-collateral">
            <div id="customer-reviews" class="box-collateral box-reviews">
                <div class="form-add">
                    <h2>Write Your Own Review</h2>
                    <form id="review-form" method="POST" action="<c:url value="/Comment"/>">
                        <fieldset>
                                    <h3>You're reviewing: <span><%= pro.getProductname() %></span></h3>
                            <ul class="form-list">
                                <li>
                                    <label class="required" for="nickname_field"><em>*</em>Nickname</label>
                                    <div class="input-box">
                                        <input type="text" value="" class="input-text required-entry" id="nickname_field" name="nickname">
                                    </div>
                                </li>
                                <li>
                                    <label class="required" for="summary_field"><em>*</em>Summary of Your Review</label>
                                    <div class="input-box">
                                        <input type="text" value="" class="input-text required-entry" id="summary_field" name="title">
                                    </div>
                                </li>
                                <li>
                                    <label class="required" for="review_field"><em>*</em>Review</label>
                                    <div class="input-box">
                                        <textarea class="required-entry" rows="3" cols="5" id="review_field" name="detail"></textarea>
                                    </div>
                                </li>
                            </ul>
                        </fieldset>
                        <div class="buttons-set">
                            <button class="button" title="Submit Review" type="submit"><span><span>Submit Review</span></span></button>
                        </div>
                    </form>
                    <script type="text/javascript">
    //&lt;![CDATA[
        var dataForm = new VarienForm('review-form');
        Validation.addAllThese(
        [
               ['validate-rating', 'Please select one of each of the ratings above', function(v) {
                    var trs = $('product-review-table').select('tr');
                    var inputs;
                    var error = 1;
    
                    for( var j=0; j < trs.length; j++ ) {
                        var tr = trs[j];
                        if( j > 0 ) {
                            inputs = tr.select('input');
    
                            for( i in inputs ) {
                                if( inputs[i].checked == true ) {
                                    error = 0;
                                }
                            }
    
                            if( error == 1 ) {
                                return false;
                            } else {
                                error = 1;
                            }
                        }
                    }
                    return true;
                }]
        ]
        );
    //]]&gt;
    </script>        
                </div>
            </div>
        </div>                
    </div>                                            
</div>